<?php
namespace Amis\form;
/**
 * 用来输入公式。还是 beta 版本，整体待优化。
 * 2022年5月4日
 */
class InputFormula extends FormItem
{
    public string $type = 'input-formula';

    public function title(string $title = '公式编辑器')
    {
        $this->title = $title;
        return $this;
    }

    public function header(string $title)
    {
        $this->header = $title;
        return $this;
    }

    public function evalMode(bool $title = true)
    {
        $this->evalMode = $title;
        return $this;
    }

    /**
     *    {label: string; value: string; children?: any[]; tag?: string}[]    []    可用变量
     * @param $variables
     * @return $this
     */
    public function variables($variables)
    {
        $this->variables = $variables;
        return $this;
    }

    /**
     * 可配置成 tabs 或者 tree 默认为列表，支持分组。
     * @param $variableMode
     * @return $this
     */
    public function variableMode($variableMode)
    {
        $this->variableMode = $variableMode;
        return $this;
    }

    public function functions($functions)
    {
        $this->functions = $functions;
        return $this;
    }

    public function inputMode($inputMode)
    {
        $this->inputMode = $inputMode;
        return $this;
    }

    public function icon($icon)
    {
        $this->icon = $icon;
        return $this;
    }

    public function btnLabel($btnLabel)
    {
        $this->btnLabel = $btnLabel;
        return $this;
    }

    /**
     *    'info' | 'success' | 'warning' | 'danger' | 'link' | 'primary' | 'dark' | 'light'
     * @param $level
     * @return $this
     */
    public function level($level)
    {
        $this->level = $level;
        return $this;
    }

    public function allowInput(string $allowInput)
    {
        $this->allowInput = $allowInput;
        return $this;
    }

    /**
     * 'xs' | 'sm' | 'md' | 'lg'
     * @param $btnSize
     * @return $this
     */
    public function btnSize($btnSize)
    {
        $this->btnSize = $btnSize;
        return $this;
    }

    /**
     * 'full' | 'half' | 'none'
     * @param $borderMode
     * @return $this
     */
    public function borderMode($borderMode)
    {
        $this->borderMode = $borderMode;
        return $this;
    }

    public function placeholder(string $placeholder = '暂无数据')
    {
        $this->placeholder = $placeholder;
        return $this;
    }

    public function variableClassName(string $variableClassName)
    {
        $this->variableClassName = $variableClassName;
        return $this;
    }

    public function functionClassName(string $functionClassName)
    {
        $this->functionClassName = $functionClassName;
        return $this;
    }
}